package com.baidu.treadCommunication;

public class SaveMoneyThread extends Thread{
    private String threadName;
    private Account account;
    private double money;

    public SaveMoneyThread(String threadName, Account account, double money) {
        this.threadName = threadName;
        this.account = account;
        this.money = money;
    }

    @Override
    public void run() {
        super.setName(this.threadName);
        while (true){
            try {
                account.saveMoney(this.money);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
}
